package encript;

public class Codificacion {

	public String encriptar(String text){
		/*
		 * Algoritmo: murcielago
		 * */

		char[] tmp = text.toCharArray();
		for (int i=0; i<tmp.length; i++){
			if (tmp[i]=='M'){
				tmp[i]='1';
				continue;
			}
			if (tmp[i]=='U'){
				tmp[i]='2';
				continue;
			}
			if (tmp[i]=='R'){
				tmp[i]='3';
				continue;
			}
			if (tmp[i]=='C'){
				tmp[i]='4';
				continue;
			}
			if (tmp[i]=='I'){
				tmp[i]='5';
				continue;
			}
			if (tmp[i]=='E'){
				tmp[i]='6';
				continue;
			}
			if (tmp[i]=='L'){
				tmp[i]='7';
				continue;
			}
			if (tmp[i]=='A'){
				tmp[i]='8';
				continue;
			}
			if (tmp[i]=='G'){
				tmp[i]='9';
				continue;
			}
			if (tmp[i]=='O'){
				tmp[i]='0';
				continue;
			}
			if (tmp[i]=='1'){
				tmp[i]='M';
				continue;
			}
			if (tmp[i]=='2'){
				tmp[i]='U';
				continue;
			}
			if (tmp[i]=='3'){
				tmp[i]='R';
				continue;
			}
			if (tmp[i]=='4'){
				tmp[i]='C';
				continue;
			}
			if (tmp[i]=='5'){
				tmp[i]='I';
				continue;
			}
			if (tmp[i]=='6'){
				tmp[i]='E';
				continue;
			}
			if (tmp[i]=='7'){
				tmp[i]='L';
				continue;
			}
			if (tmp[i]=='8'){
				tmp[i]='A';
				continue;
			}
			if (tmp[i]=='9'){
				tmp[i]='G';
				continue;
			}
			if (tmp[i]=='0'){
				tmp[i]='O';
				continue;
			}			
		}

		return new String(tmp);
	}

	
	public String desencriptar(String text){
		/*
		 * Algoritmo: murcielago
		 * */

		char[] tmp = text.toCharArray();
		for (int i=0; i<tmp.length; i++){
			if (tmp[i]=='M'){
				tmp[i]='1';
				continue;
			}
			if (tmp[i]=='U'){
				tmp[i]='2';
				continue;
			}
			if (tmp[i]=='R'){
				tmp[i]='3';
				continue;
			}
			if (tmp[i]=='C'){
				tmp[i]='4';
				continue;
			}
			if (tmp[i]=='I'){
				tmp[i]='5';
				continue;
			}
			if (tmp[i]=='E'){
				tmp[i]='6';
				continue;
			}
			if (tmp[i]=='L'){
				tmp[i]='7';
				continue;
			}
			if (tmp[i]=='A'){
				tmp[i]='8';
				continue;
			}
			if (tmp[i]=='G'){
				tmp[i]='9';
				continue;
			}
			if (tmp[i]=='O'){
				tmp[i]='0';
				continue;
			}
			if (tmp[i]=='1'){
				tmp[i]='M';
				continue;
			}
			if (tmp[i]=='2'){
				tmp[i]='U';
				continue;
			}
			if (tmp[i]=='3'){
				tmp[i]='R';
				continue;
			}
			if (tmp[i]=='4'){
				tmp[i]='C';
				continue;
			}
			if (tmp[i]=='5'){
				tmp[i]='I';
				continue;
			}
			if (tmp[i]=='6'){
				tmp[i]='E';
				continue;
			}
			if (tmp[i]=='7'){
				tmp[i]='L';
				continue;
			}
			if (tmp[i]=='8'){
				tmp[i]='A';
				continue;
			}
			if (tmp[i]=='9'){
				tmp[i]='G';
				continue;
			}
			if (tmp[i]=='0'){
				tmp[i]='O';
				continue;
			}			
		}

		return new String(tmp);
	}
}